protected void reindexFolders(final long companyId) throws PortalException, SystemException {

    ActionableDynamicQuery actionableDynamicQuery =
        new DLFolderActionableDynamicQuery() {

          @Override
          protected void performAction(Object object) throws PortalException {
            DLFolder dlFolder = (DLFolder) object;

            String portletId = PortletKeys.DOCUMENT_LIBRARY;
            long groupId = dlFolder.getGroupId();
            long folderId = dlFolder.getFolderId();

            String[] newIds = {
              String.valueOf(companyId),
              portletId,
              String.valueOf(groupId),
              String.valueOf(folderId)
            };

            reindex(newIds);
          }
        };

    actionableDynamicQuery.setCompanyId(companyId);

    actionableDynamicQuery.performActions();
  }
  @Override
  public void trashSyncDLObjects(final SyncDLObject parentSyncDLObject) throws PortalException {

    ActionableDynamicQuery actionableDynamicQuery = getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

          @Override
          public void addCriteria(DynamicQuery dynamicQuery) {
            dynamicQuery.add(
                RestrictionsFactoryUtil.ne("event", SyncDLObjectConstants.EVENT_TRASH));

            String treePath = parentSyncDLObject.getTreePath();

            dynamicQuery.add(
                RestrictionsFactoryUtil.like("treePath", treePath + StringPool.PERCENT));
          }
        });
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod<SyncDLObject>() {

          @Override
          public void performAction(SyncDLObject syncDLObject) throws PortalException {

            syncDLObject.setUserId(parentSyncDLObject.getUserId());
            syncDLObject.setUserName(parentSyncDLObject.getUserName());
            syncDLObject.setEvent(SyncDLObjectConstants.EVENT_TRASH);

            syncDLObjectPersistence.update(syncDLObject);
          }
        });

    actionableDynamicQuery.performActions();
  }
  protected void reindexFileEntries(long companyId, final long groupId, final long dataRepositoryId)
      throws PortalException, SystemException {

    final Collection<Document> documents = new ArrayList<Document>();

    ActionableDynamicQuery actionableDynamicQuery =
        new DLFileEntryActionableDynamicQuery() {

          @Override
          protected void addCriteria(DynamicQuery dynamicQuery) {
            Property property = PropertyFactoryUtil.forName("folderId");

            long folderId = DLFolderConstants.getFolderId(groupId, dataRepositoryId);

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

          @Override
          protected void performAction(Object object) throws PortalException {
            DLFileEntry dlFileEntry = (DLFileEntry) object;

            Document document = getDocument(dlFileEntry);

            if (document != null) {
              documents.add(document);
            }
          }
        };

    actionableDynamicQuery.setGroupId(groupId);

    actionableDynamicQuery.performActions();

    SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents);
  }
  protected void reindexCalendars(long companyId) throws PortalException {
    final ActionableDynamicQuery actionableDynamicQuery =
        _calendarLocalService.getActionableDynamicQuery();

    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod<Calendar>() {

          @Override
          public void performAction(Calendar calendar) {
            try {
              Document document = getDocument(calendar);

              actionableDynamicQuery.addDocument(document);
            } catch (PortalException pe) {
              if (_log.isWarnEnabled()) {
                _log.warn("Unable to index calendar " + calendar.getCalendarId(), pe);
              }
            }
          }
        });

    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
  @Override
  protected String doExportData(
      PortletDataContext portletDataContext,
      String portletId,
      PortletPreferences portletPreferences)
      throws Exception {

    Element rootElement = addExportDataRootElement(portletDataContext);

    rootElement.addAttribute("group-id", String.valueOf(portletDataContext.getScopeGroupId()));

    if (portletDataContext.getBooleanParameter(NAMESPACE, "categories")) {
      ActionableDynamicQuery categoryActionableDynamicQuery =
          getCategoryActionableDynamicQuery(portletDataContext);

      categoryActionableDynamicQuery.performActions();
    }

    if (portletDataContext.getBooleanParameter(NAMESPACE, "vocabularies")) {
      ActionableDynamicQuery vocabularyActionableDynamicQuery =
          getVocabularyActionableDynamicQuery(portletDataContext);

      vocabularyActionableDynamicQuery.performActions();
    }

    return getExportDataRootElementString(rootElement);
  }
  @Override
  protected void doPrepareManifestSummary(
      PortletDataContext portletDataContext, PortletPreferences portletPreferences)
      throws Exception {

    ActionableDynamicQuery banActionableDynamicQuery =
        _mbBanLocalService.getExportActionableDynamicQuery(portletDataContext);

    banActionableDynamicQuery.performCount();

    ActionableDynamicQuery categoryActionableDynamicQuery =
        _mbCategoryLocalService.getExportActionableDynamicQuery(portletDataContext);

    categoryActionableDynamicQuery.performCount();

    ActionableDynamicQuery messageActionableDynamicQuery =
        getMessageActionableDynamicQuery(portletDataContext);

    messageActionableDynamicQuery.performCount();

    ActionableDynamicQuery threadActionableDynamicQuery =
        _mbThreadLocalService.getExportActionableDynamicQuery(portletDataContext);

    threadActionableDynamicQuery.performCount();

    ActionableDynamicQuery threadFlagActionableDynamicQuery =
        _mbThreadFlagLocalService.getExportActionableDynamicQuery(portletDataContext);

    threadFlagActionableDynamicQuery.performCount();
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(mdrRuleGroupLocalService);
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(MDRRuleGroup.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("ruleGroupId");
  }
  @Override
  public void checkAssetEntries() throws Exception {
    ActionableDynamicQuery actionableDynamicQuery =
        new PortletPreferencesActionableDynamicQuery() {

          @Override
          protected void addCriteria(DynamicQuery dynamicQuery) {
            Property property = PropertyFactoryUtil.forName("portletId");

            String portletId =
                PortletKeys.ASSET_PUBLISHER
                    + PortletConstants.INSTANCE_SEPARATOR
                    + StringPool.PERCENT;

            dynamicQuery.add(property.like(portletId));
          }

          @Override
          protected void performAction(Object object) throws PortalException, SystemException {

            com.liferay.portal.model.PortletPreferences portletPreferences =
                (com.liferay.portal.model.PortletPreferences) object;

            _checkAssetEntries(portletPreferences);
          }
        };

    actionableDynamicQuery.performActions();
  }
  protected void exportAssetLinks(PortletDataContext portletDataContext) throws Exception {

    Document document = SAXReaderUtil.createDocument();

    Element rootElement = document.addElement("links");

    Element exportDataRootElement = portletDataContext.getExportDataRootElement();

    try {
      portletDataContext.setExportDataRootElement(rootElement);

      ActionableDynamicQuery linkActionableDynamicQuery =
          _assetLinkLocalService.getExportActionbleDynamicQuery(portletDataContext);

      linkActionableDynamicQuery.performActions();

      for (long linkId : portletDataContext.getAssetLinkIds()) {
        AssetLink assetLink = _assetLinkLocalService.getAssetLink(linkId);

        StagedAssetLink stagedAssetLink =
            ModelAdapterUtil.adapt(assetLink, AssetLink.class, StagedAssetLink.class);

        portletDataContext.addClassedModel(
            portletDataContext.getExportDataElement(stagedAssetLink),
            ExportImportPathUtil.getModelPath(stagedAssetLink),
            stagedAssetLink);
      }
    } finally {
      portletDataContext.setExportDataRootElement(exportDataRootElement);
    }

    portletDataContext.addZipEntry(
        ExportImportPathUtil.getRootPath(portletDataContext) + "/links.xml",
        document.formattedString());
  }
Exemplo n.º 10
0
  protected void reindexFolders(long companyId) throws PortalException, SystemException {

    final Collection<Document> documents = new ArrayList<Document>();

    ActionableDynamicQuery actionableDynamicQuery =
        new JournalFolderActionableDynamicQuery() {

          @Override
          protected void performAction(Object object) throws PortalException {
            JournalFolder folder = (JournalFolder) object;

            Document document = getDocument(folder);

            if (document != null) {
              documents.add(document);
            }
          }
        };

    actionableDynamicQuery.setCompanyId(companyId);

    actionableDynamicQuery.performActions();

    SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents);
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(calendarLocalService);
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(Calendar.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("calendarId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(shoppingCouponLocalService);
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(ShoppingCoupon.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("couponId");
  }
Exemplo n.º 13
0
  protected void reindexFolders(final long companyId) throws PortalException, SystemException {

    ActionableDynamicQuery actionableDynamicQuery =
        new DLFolderActionableDynamicQuery() {

          @Override
          protected void addCriteria(DynamicQuery dynamicQuery) {
            Property property = PropertyFactoryUtil.forName("mountPoint");

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

          @Override
          protected void performAction(Object object) throws PortalException {
            DLFolder dlFolder = (DLFolder) object;

            Document document = getDocument(dlFolder);

            if (document != null) {
              addDocument(document);
            }
          }
        };

    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(resourceBlockPermissionLocalService);
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(ResourceBlockPermission.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("resourceBlockPermissionId");
  }
  protected void reindexRoot(final long companyId) throws PortalException {
    ActionableDynamicQuery actionableDynamicQuery =
        GroupLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {

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

            Group group = (Group) object;

            String portletId = PortletKeys.DOCUMENT_LIBRARY;
            long groupId = group.getGroupId();
            long folderId = groupId;

            String[] newIds = {
              String.valueOf(companyId),
              portletId,
              String.valueOf(groupId),
              String.valueOf(folderId)
            };

            reindex(newIds);
          }
        });

    actionableDynamicQuery.performActions();
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portlet.dynamicdatamapping.service.DDMContentLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(DDMContent.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("contentId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portal.service.ExportImportConfigurationLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(ExportImportConfiguration.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("exportImportConfigurationId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.document.library.kernel.service.DLFileEntryTypeLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(DLFileEntryType.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("fileEntryTypeId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.shopping.service.ShoppingOrderLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(ShoppingOrder.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("orderId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.wsrp.service.WSRPConsumerPortletLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(WSRPConsumerPortlet.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("wsrpConsumerPortletId");
  }
	protected void initActionableDynamicQuery(
		ActionableDynamicQuery actionableDynamicQuery) {
		actionableDynamicQuery.setBaseLocalService(com.liferay.mail.service.MessageLocalServiceUtil.getService());
		actionableDynamicQuery.setClass(Message.class);
		actionableDynamicQuery.setClassLoader(getClassLoader());

		actionableDynamicQuery.setPrimaryKeyPropertyName("messageId");
	}
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portal.service.LayoutFriendlyURLLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(LayoutFriendlyURL.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("layoutFriendlyURLId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.expando.kernel.service.ExpandoTableLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(ExpandoTable.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("tableId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.chat.service.StatusLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(Status.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("statusId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portal.service.WebsiteLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(Website.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("websiteId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.message.boards.kernel.service.MBDiscussionLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(MBDiscussion.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("discussionId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portal.service.MembershipRequestLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(MembershipRequest.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("membershipRequestId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portlet.social.service.SocialActivityAchievementLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(SocialActivityAchievement.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("activityAchievementId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.portlet.ratings.service.RatingsStatsLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(RatingsStats.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("statsId");
  }
  protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.knowledgebase.service.KBTemplateLocalServiceUtil.getService());
    actionableDynamicQuery.setClassLoader(getClassLoader());
    actionableDynamicQuery.setModelClass(KBTemplate.class);

    actionableDynamicQuery.setPrimaryKeyPropertyName("kbTemplateId");
  }