@Override
  public List<AssetVocabulary> getVocabularies(Hits hits) throws PortalException {

    List<Document> documents = hits.toList();

    List<AssetVocabulary> vocabularies = new ArrayList<>(documents.size());

    for (Document document : documents) {
      long vocabularyId = GetterUtil.getLong(document.get(Field.ASSET_VOCABULARY_ID));

      AssetVocabulary vocabulary = fetchAssetVocabulary(vocabularyId);

      if (vocabulary == null) {
        vocabularies = null;

        Indexer indexer = IndexerRegistryUtil.getIndexer(AssetVocabulary.class);

        long companyId = GetterUtil.getLong(document.get(Field.COMPANY_ID));

        indexer.delete(companyId, document.getUID());
      } else if (vocabularies != null) {
        vocabularies.add(vocabulary);
      }
    }

    return vocabularies;
  }
  @Override
  @SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE)
  public void deleteCategory(MBCategory category, boolean includeTrashedEntries)
      throws PortalException, SystemException {

    // Categories

    List<MBCategory> categories =
        mbCategoryPersistence.findByG_P(category.getGroupId(), category.getCategoryId());

    for (MBCategory curCategory : categories) {
      if (includeTrashedEntries || !curCategory.isInTrash()) {
        deleteCategory(curCategory, includeTrashedEntries);
      }
    }

    // Indexer

    Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(MBMessage.class);

    indexer.delete(category);

    // Threads

    mbThreadLocalService.deleteThreads(
        category.getGroupId(), category.getCategoryId(), includeTrashedEntries);

    // Mailing list

    try {
      mbMailingListLocalService.deleteCategoryMailingList(
          category.getGroupId(), category.getCategoryId());
    } catch (NoSuchMailingListException nsmle) {
    }

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(
        category.getCompanyId(), MBCategory.class.getName(), category.getCategoryId());

    // Expando

    expandoRowLocalService.deleteRows(category.getCategoryId());

    // Resources

    resourceLocalService.deleteResource(
        category.getCompanyId(),
        MBCategory.class.getName(),
        ResourceConstants.SCOPE_INDIVIDUAL,
        category.getCategoryId());

    // Trash

    trashEntryLocalService.deleteEntry(MBCategory.class.getName(), category.getCategoryId());

    // Category

    mbCategoryPersistence.remove(category);
  }
  @Override
  public List<AssetCategory> getCategories(Hits hits) throws PortalException {
    List<Document> documents = hits.toList();

    List<AssetCategory> categories = new ArrayList<>(documents.size());

    for (Document document : documents) {
      long categoryId = GetterUtil.getLong(document.get(Field.ASSET_CATEGORY_ID));

      AssetCategory category = fetchCategory(categoryId);

      if (category == null) {
        categories = null;

        Indexer<AssetCategory> indexer = IndexerRegistryUtil.getIndexer(AssetCategory.class);

        long companyId = GetterUtil.getLong(document.get(Field.COMPANY_ID));

        indexer.delete(companyId, document.getUID());
      } else if (categories != null) {
        categories.add(category);
      }
    }

    return categories;
  }
  public void removePluginPackage(PluginPackage pluginPackage) throws PortalException {

    _pluginPackages.remove(pluginPackage.getContext());

    Indexer indexer = IndexerRegistryUtil.getIndexer(PluginPackage.class);

    indexer.delete(pluginPackage);
  }
 /**
  * Xóa bỏ thông tin một thống kê theo ngày
  *
  * <p>Version: OEP 2.0
  *
  * <p>History: DATE AUTHOR DESCRIPTION -------------------------------------------------
  * 21-September-2015 trungdk Xóa bỏ thông tin thống kê theo ngày
  *
  * @param statisticByDomain thống kê theo ngày được xóa
  * @return
  */
 public void removeStatisticByDomain(StatisticByDomain statisticByDomain)
     throws PortalException, SystemException {
   statisticByDomainPersistence.remove(statisticByDomain);
   Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(StatisticByDomain.class);
   indexer.delete(statisticByDomain);
   resourceLocalService.deleteResource(
       statisticByDomain.getCompanyId(),
       StatisticByDomain.class.getName(),
       ResourceConstants.SCOPE_INDIVIDUAL,
       statisticByDomain.getStatisticByDomainId());
 }
Exemplo n.º 6
0
  public void deleteCategory(MBCategory category) throws PortalException, SystemException {

    // Categories

    List<MBCategory> categories =
        mbCategoryPersistence.findByG_P(category.getGroupId(), category.getCategoryId());

    for (MBCategory curCategory : categories) {
      deleteCategory(curCategory);
    }

    // Indexer

    Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(MBMessage.class);

    indexer.delete(category);

    // Threads

    mbThreadLocalService.deleteThreads(category.getGroupId(), category.getCategoryId());

    // Mailing list

    try {
      mbMailingListLocalService.deleteCategoryMailingList(
          category.getGroupId(), category.getCategoryId());
    } catch (NoSuchMailingListException nsmle) {
    }

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(
        category.getCompanyId(), MBCategory.class.getName(), category.getCategoryId());

    // Expando

    expandoValueLocalService.deleteValues(MBCategory.class.getName(), category.getCategoryId());

    // Resources

    resourceLocalService.deleteResource(
        category.getCompanyId(),
        MBCategory.class.getName(),
        ResourceConstants.SCOPE_INDIVIDUAL,
        category.getCategoryId());

    // Category

    mbCategoryPersistence.remove(category);
  }
  /**
   * Deletes the calendar booking from the database. Also notifies the appropriate model listeners.
   *
   * @param calendarBooking the calendar booking
   * @throws SystemException if a system exception occurred
   */
  public void deleteCalendarBooking(CalendarBooking calendarBooking) throws SystemException {
    calendarBookingPersistence.remove(calendarBooking);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(calendarBooking);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the j i r a issue with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param jiraIssueId the primary key of the j i r a issue
   * @throws PortalException if a j i r a issue with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteJIRAIssue(long jiraIssueId) throws PortalException, SystemException {
    JIRAIssue jiraIssue = jiraIssuePersistence.remove(jiraIssueId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(jiraIssue);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the kaleo log with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param kaleoLogId the primary key of the kaleo log
   * @throws PortalException if a kaleo log with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteKaleoLog(long kaleoLogId) throws PortalException, SystemException {
    KaleoLog kaleoLog = kaleoLogPersistence.remove(kaleoLogId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(kaleoLog);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the message boards ban with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param banId the primary key of the message boards ban
   * @throws PortalException if a message boards ban with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteMBBan(long banId) throws PortalException, SystemException {
    MBBan mbBan = mbBanPersistence.remove(banId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(mbBan);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the kaleo task form from the database. Also notifies the appropriate model listeners.
   *
   * @param kaleoTaskForm the kaleo task form
   * @throws SystemException if a system exception occurred
   */
  public void deleteKaleoTaskForm(KaleoTaskForm kaleoTaskForm) throws SystemException {
    kaleoTaskFormPersistence.remove(kaleoTaskForm);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(kaleoTaskForm);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
Exemplo n.º 12
0
  @Override
  protected void doDelete(Object obj) throws Exception {
    DLFileEntry dlFileEntry = (DLFileEntry) obj;

    FileModel fileModel = new FileModel();

    fileModel.setCompanyId(dlFileEntry.getCompanyId());
    fileModel.setFileName(dlFileEntry.getName());
    fileModel.setPortletId(PORTLET_ID);
    fileModel.setRepositoryId(dlFileEntry.getDataRepositoryId());

    Indexer indexer = IndexerRegistryUtil.getIndexer(FileModel.class);

    indexer.delete(fileModel);
  }
  /**
   * Deletes the j i r a change group from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param jiraChangeGroup the j i r a change group
   * @throws SystemException if a system exception occurred
   */
  public void deleteJIRAChangeGroup(JIRAChangeGroup jiraChangeGroup) throws SystemException {
    jiraChangeGroupPersistence.remove(jiraChangeGroup);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(jiraChangeGroup);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the user thread from the database. Also notifies the appropriate model listeners.
   *
   * @param userThread the user thread
   * @throws SystemException if a system exception occurred
   */
  public void deleteUserThread(UserThread userThread) throws SystemException {
    userThreadPersistence.remove(userThread);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(userThread);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the k b comment from the database. Also notifies the appropriate model listeners.
   *
   * @param kbComment the k b comment
   * @throws SystemException if a system exception occurred
   */
  public void deleteKBComment(KBComment kbComment) throws SystemException {
    kbCommentPersistence.remove(kbComment);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(kbComment);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the social request from the database. Also notifies the appropriate model listeners.
   *
   * @param socialRequest the social request
   * @throws SystemException if a system exception occurred
   */
  public void deleteSocialRequest(SocialRequest socialRequest) throws SystemException {
    socialRequestPersistence.remove(socialRequest);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(socialRequest);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the ratings entry with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param entryId the primary key of the ratings entry
   * @throws PortalException if a ratings entry with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteRatingsEntry(long entryId) throws PortalException, SystemException {
    RatingsEntry ratingsEntry = ratingsEntryPersistence.remove(entryId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(ratingsEntry);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the feed with the primary key from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param feedId the primary key of the feed
   * @throws PortalException if a feed with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteFeed(long feedId) throws PortalException, SystemException {
    Feed feed = feedPersistence.remove(feedId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(feed);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
Exemplo n.º 19
0
  @Override
  protected void doDelete(Object obj) throws Exception {
    User user = (User) obj;

    deleteDocument(user.getCompanyId(), user.getUserId());

    Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(Contact.class);

    Contact contact = new ContactImpl();

    contact.setContactId(user.getContactId());
    contact.setCompanyId(user.getCompanyId());

    indexer.delete(contact);
  }
  /**
   * Deletes the journal template from the database. Also notifies the appropriate model listeners.
   *
   * @param journalTemplate the journal template
   * @throws SystemException if a system exception occurred
   */
  public void deleteJournalTemplate(JournalTemplate journalTemplate) throws SystemException {
    journalTemplatePersistence.remove(journalTemplate);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(journalTemplate);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the document library file shortcut from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param dlFileShortcut the document library file shortcut
   * @throws SystemException if a system exception occurred
   */
  public void deleteDLFileShortcut(DLFileShortcut dlFileShortcut) throws SystemException {
    dlFileShortcutPersistence.remove(dlFileShortcut);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(dlFileShortcut);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the definition from the database. Also notifies the appropriate model listeners.
   *
   * @param definition the definition
   * @throws SystemException if a system exception occurred
   */
  public void deleteDefinition(Definition definition) throws SystemException {
    definitionPersistence.remove(definition);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(definition);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the social relation with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param relationId the primary key of the social relation
   * @throws PortalException if a social relation with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteSocialRelation(long relationId) throws PortalException, SystemException {
    SocialRelation socialRelation = socialRelationPersistence.remove(relationId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(socialRelation);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the f a q category question with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param id the primary key of the f a q category question
   * @throws PortalException if a f a q category question with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteFAQCategoryQuestion(long id) throws PortalException, SystemException {
    FAQCategoryQuestion faqCategoryQuestion = faqCategoryQuestionPersistence.remove(id);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(faqCategoryQuestion);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the wiki page with the primary key from the database. Also notifies the appropriate
   * model listeners.
   *
   * @param pageId the primary key of the wiki page
   * @throws PortalException if a wiki page with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteWikiPage(long pageId) throws PortalException, SystemException {
    WikiPage wikiPage = wikiPagePersistence.remove(pageId);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(wikiPage);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the asset link from the database. Also notifies the appropriate model listeners.
   *
   * @param assetLink the asset link
   * @throws SystemException if a system exception occurred
   */
  public void deleteAssetLink(AssetLink assetLink) throws SystemException {
    assetLinkPersistence.remove(assetLink);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(assetLink);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the meetups entry from the database. Also notifies the appropriate model listeners.
   *
   * @param meetupsEntry the meetups entry
   * @throws SystemException if a system exception occurred
   */
  public void deleteMeetupsEntry(MeetupsEntry meetupsEntry) throws SystemException {
    meetupsEntryPersistence.remove(meetupsEntry);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(meetupsEntry);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the tai khoan nguoi dung from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param taiKhoanNguoiDung the tai khoan nguoi dung
   * @throws SystemException if a system exception occurred
   */
  public void deleteTaiKhoanNguoiDung(TaiKhoanNguoiDung taiKhoanNguoiDung) throws SystemException {
    taiKhoanNguoiDungPersistence.remove(taiKhoanNguoiDung);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(taiKhoanNguoiDung);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the message boards message flag from the database. Also notifies the appropriate model
   * listeners.
   *
   * @param mbMessageFlag the message boards message flag
   * @throws SystemException if a system exception occurred
   */
  public void deleteMBMessageFlag(MBMessageFlag mbMessageFlag) throws SystemException {
    mbMessageFlagPersistence.remove(mbMessageFlag);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(mbMessageFlag);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }
  /**
   * Deletes the journal structure with the primary key from the database. Also notifies the
   * appropriate model listeners.
   *
   * @param id the primary key of the journal structure
   * @throws PortalException if a journal structure with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public void deleteJournalStructure(long id) throws PortalException, SystemException {
    JournalStructure journalStructure = journalStructurePersistence.remove(id);

    Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());

    if (indexer != null) {
      try {
        indexer.delete(journalStructure);
      } catch (SearchException se) {
        if (_log.isWarnEnabled()) {
          _log.warn(se, se);
        }
      }
    }
  }