Example usage for com.liferay.portal.kernel.search IndexerRegistryUtil getIndexer

List of usage examples for com.liferay.portal.kernel.search IndexerRegistryUtil getIndexer

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search IndexerRegistryUtil getIndexer.

Prototype

public static <T> Indexer<T> getIndexer(String className) 

Source Link

Usage

From source file:br.com.seatecnologia.banner.service.base.BannerLocalServiceBaseImpl.java

License:Open Source License

/**
 * Adds the banner to the database. Also notifies the appropriate model listeners.
 *
 * @param banner the banner// ww  w . j a  v  a 2s  . c  om
 * @return the banner that was added
 * @throws SystemException if a system exception occurred
 */
public Banner addBanner(Banner banner) throws SystemException {
    banner.setNew(true);

    banner = bannerPersistence.update(banner, false);

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

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

    return banner;
}

From source file:br.com.seatecnologia.banner.service.base.BannerLocalServiceBaseImpl.java

License:Open Source License

/**
 * Deletes the banner with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param bannerId the primary key of the banner
 * @throws PortalException if a banner with the primary key could not be found
 * @throws SystemException if a system exception occurred
 *//*from   ww w  .  j a  va 2  s. co  m*/
public void deleteBanner(long bannerId) throws PortalException, SystemException {
    Banner banner = bannerPersistence.remove(bannerId);

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

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

From source file:br.com.seatecnologia.banner.service.base.BannerLocalServiceBaseImpl.java

License:Open Source License

/**
 * Deletes the banner from the database. Also notifies the appropriate model listeners.
 *
 * @param banner the banner//from w  w w .j a va  2  s .  c o m
 * @throws SystemException if a system exception occurred
 */
public void deleteBanner(Banner banner) throws SystemException {
    bannerPersistence.remove(banner);

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

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

From source file:br.com.seatecnologia.banner.service.base.BannerLocalServiceBaseImpl.java

License:Open Source License

/**
 * Updates the banner in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
 *
 * @param banner the banner/*from w  w w.  jav  a  2  s . co  m*/
 * @param merge whether to merge the banner with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
 * @return the banner that was updated
 * @throws SystemException if a system exception occurred
 */
public Banner updateBanner(Banner banner, boolean merge) throws SystemException {
    banner.setNew(false);

    banner = bannerPersistence.update(banner, merge);

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

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

    return banner;
}

From source file:br.com.seatecnologia.cldf.enquetenoticia.service.base.EnqueteNoticiaLocalServiceBaseImpl.java

License:Open Source License

/**
 * Adds the enquete noticia to the database. Also notifies the appropriate model listeners.
 *
 * @param enqueteNoticia the enquete noticia
 * @return the enquete noticia that was added
 * @throws SystemException if a system exception occurred
 *//*w  w  w.j  a  va 2 s . c  o  m*/
public EnqueteNoticia addEnqueteNoticia(EnqueteNoticia enqueteNoticia) throws SystemException {
    enqueteNoticia.setNew(true);

    enqueteNoticia = enqueteNoticiaPersistence.update(enqueteNoticia, false);

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

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

    return enqueteNoticia;
}

From source file:br.com.seatecnologia.cldf.enquetenoticia.service.base.EnqueteNoticiaLocalServiceBaseImpl.java

License:Open Source License

/**
 * Deletes the enquete noticia with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param enqueteNoticiaId the primary key of the enquete noticia
 * @throws PortalException if a enquete noticia with the primary key could not be found
 * @throws SystemException if a system exception occurred
 *//*from   w ww .j  a  v a  2  s . c  o  m*/
public void deleteEnqueteNoticia(long enqueteNoticiaId) throws PortalException, SystemException {
    EnqueteNoticia enqueteNoticia = enqueteNoticiaPersistence.remove(enqueteNoticiaId);

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

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

From source file:br.com.seatecnologia.cldf.enquetenoticia.service.base.EnqueteNoticiaLocalServiceBaseImpl.java

License:Open Source License

/**
 * Deletes the enquete noticia from the database. Also notifies the appropriate model listeners.
 *
 * @param enqueteNoticia the enquete noticia
 * @throws SystemException if a system exception occurred
 *///from   www . j a  v  a 2 s. c om
public void deleteEnqueteNoticia(EnqueteNoticia enqueteNoticia) throws SystemException {
    enqueteNoticiaPersistence.remove(enqueteNoticia);

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

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

From source file:br.com.seatecnologia.cldf.enquetenoticia.service.base.EnqueteNoticiaLocalServiceBaseImpl.java

License:Open Source License

/**
 * Updates the enquete noticia in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
 *
 * @param enqueteNoticia the enquete noticia
 * @param merge whether to merge the enquete noticia with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
 * @return the enquete noticia that was updated
 * @throws SystemException if a system exception occurred
 */// w  w w.  j a  v a  2 s. co m
public EnqueteNoticia updateEnqueteNoticia(EnqueteNoticia enqueteNoticia, boolean merge)
        throws SystemException {
    enqueteNoticia.setNew(false);

    enqueteNoticia = enqueteNoticiaPersistence.update(enqueteNoticia, merge);

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

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

    return enqueteNoticia;
}

From source file:br.com.seatecnologia.treinamento.service.impl.ModeloLocalServiceImpl.java

License:Open Source License

@Override
public Modelo addModelo(Modelo modelo) throws SystemException {
    Long modeloId = counterLocalService.increment(Modelo.class.getName());
    modelo.setModeloId(modeloId);/* www .  j  a v a2 s . c  o m*/
    modelo.setNew(true);
    Indexer indexer = IndexerRegistryUtil.getIndexer(Modelo.class.getName());
    try {
        indexer.reindex(modelo);
        return super.addModelo(modelo);
    } catch (SearchException e) {
        e.printStackTrace();
        return null;
    }

}

From source file:ca.efendi.datafeeds.search.CJProductOpenSearchImpl.java

License:Apache License

@Override
public Indexer<CJProduct> getIndexer() {
    return IndexerRegistryUtil.getIndexer(CJProduct.class);
}