Ejemplo n.º 1
0
  protected void reindexKBArticles(long companyId) throws Exception {
    final ActionableDynamicQuery actionableDynamicQuery =
        KBArticleLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

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

            dynamicQuery.add(property.eq(WorkflowConstants.STATUS_APPROVED));
          }
        });
    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {

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

            KBArticle kbArticle = (KBArticle) object;

            Document document = getDocument(kbArticle);

            actionableDynamicQuery.addDocument(document);
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
Ejemplo n.º 2
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();
  }
Ejemplo n.º 3
0
  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();
  }
  protected void reindexFileEntries(long companyId, final long groupId, final long dataRepositoryId)
      throws PortalException {

    final ActionableDynamicQuery actionableDynamicQuery =
        DLFileEntryLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

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

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

            dynamicQuery.add(property.eq(folderId));
          }
        });
    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setGroupId(groupId);
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {

          @Override
          public void performAction(Object object) {
            DLFileEntry dlFileEntry = (DLFileEntry) object;

            try {
              Document document = getDocument(dlFileEntry);

              if (document != null) {
                actionableDynamicQuery.addDocument(document);
              }
            } catch (PortalException pe) {
              if (_log.isWarnEnabled()) {
                _log.warn(
                    "Unable to index document library file entry " + dlFileEntry.getFileEntryId(),
                    pe);
              }
            }
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
Ejemplo n.º 5
0
  protected void reindexMessages(long companyId) throws PortalException, SystemException {

    ActionableDynamicQuery actionableDynamicQuery =
        new MessageActionableDynamicQuery() {

          @Override
          protected void performAction(Object object) throws PortalException {
            Message message = (Message) object;

            Document document = getDocument(message);

            addDocument(document);
          }
        };

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

    actionableDynamicQuery.performActions();
  }
Ejemplo n.º 6
0
  protected void reindexEntries(long companyId) throws PortalException {
    final ActionableDynamicQuery actionableDynamicQuery =
        BlogsEntryLocalServiceUtil.getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

          @Override
          public void addCriteria(DynamicQuery dynamicQuery) {
            Property displayDateProperty = PropertyFactoryUtil.forName("displayDate");

            dynamicQuery.add(displayDateProperty.lt(new Date()));

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

            Integer[] statuses = {
              WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH
            };

            dynamicQuery.add(statusProperty.in(statuses));
          }
        });
    actionableDynamicQuery.setCompanyId(companyId);
    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {

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

            BlogsEntry entry = (BlogsEntry) object;

            Document document = getDocument(entry);

            actionableDynamicQuery.addDocument(document);
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

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

    ActionableDynamicQuery actionableDynamicQuery =
        new AssetCategoryActionableDynamicQuery() {

          @Override
          protected void performAction(Object object) throws PortalException {
            AssetCategory category = (AssetCategory) object;

            Document document = getDocument(category);

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

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

    actionableDynamicQuery.performActions();
  }
  protected void reindexArticles(long companyId) throws PortalException {
    final ActionableDynamicQuery actionableDynamicQuery =
        _journalArticleLocalService.getActionableDynamicQuery();

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

          @Override
          public void performAction(Object object) {
            JournalArticle article = (JournalArticle) object;

            if (!JournalServiceConfigurationValues.JOURNAL_ARTICLE_INDEX_ALL_VERSIONS) {

              JournalArticle latestIndexableArticle =
                  fetchLatestIndexableArticleVersion(article.getResourcePrimKey());

              if (latestIndexableArticle == null) {
                return;
              }

              article = latestIndexableArticle;
            }

            try {
              Document document = getDocument(article);

              actionableDynamicQuery.addDocument(document);
            } catch (PortalException pe) {
              if (_log.isWarnEnabled()) {
                _log.warn("Unable to index journal article " + article.getId(), pe);
              }
            }
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
  protected void reindexCalendars(long companyId) throws PortalException {
    final ActionableDynamicQuery actionableDynamicQuery =
        CalendarLocalServiceUtil.getActionableDynamicQuery();

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

          @Override
          public void performAction(Object object) throws PortalException {
            Calendar calendar = (Calendar) object;

            Document document = getDocument(calendar);

            actionableDynamicQuery.addDocument(document);
          }
        });

    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
  protected void reindexExportImportConfigurations(long companyId) throws PortalException {

    final ActionableDynamicQuery actionableDynamicQuery =
        ExportImportConfigurationLocalServiceUtil.getActionableDynamicQuery();

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

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

            ExportImportConfiguration exportImportConfiguration =
                (ExportImportConfiguration) object;

            Document document = getDocument(exportImportConfiguration);

            actionableDynamicQuery.addDocument(document);
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }
Ejemplo n.º 11
0
  protected void reindexUsers(long companyId) throws PortalException {
    final ActionableDynamicQuery actionableDynamicQuery =
        UserLocalServiceUtil.getActionableDynamicQuery();

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

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

            User user = (User) object;

            if (!user.isDefaultUser()) {
              Document document = getDocument(user);

              actionableDynamicQuery.addDocument(document);
            }
          }
        });
    actionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    actionableDynamicQuery.performActions();
  }