/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.journal.internal.instance.lifecycle; import com.liferay.journal.configuration.JournalServiceConfiguration; import com.liferay.journal.service.JournalContentSearchLocalService; import com.liferay.portal.instance.lifecycle.BasePortalInstanceLifecycleListener; import com.liferay.portal.instance.lifecycle.PortalInstanceLifecycleListener; import com.liferay.portal.kernel.model.Company; import com.liferay.portal.kernel.module.configuration.ConfigurationProvider; import com.liferay.portal.kernel.module.framework.ModuleServiceLifecycle; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Eudaldo Alonso */ @Component(immediate = true, service = PortalInstanceLifecycleListener.class) public class CheckJournalContentSearchPortalInstanceLifecycleListener extends BasePortalInstanceLifecycleListener { @Override public void portalInstanceRegistered(Company company) throws Exception { JournalServiceConfiguration journalServiceConfiguration = _configurationProvider.getCompanyConfiguration( JournalServiceConfiguration.class, company.getCompanyId()); if (!journalServiceConfiguration.syncContentSearchOnStartup()) { return; } _journalContentSearchLocalService.checkContentSearches( company.getCompanyId()); } @Reference(unbind = "-") protected void setConfigurationProvider( ConfigurationProvider configurationProvider) { _configurationProvider = configurationProvider; } @Reference(unbind = "-") protected void setJournalContentSearchLocalService( JournalContentSearchLocalService journalContentSearchLocalService) { _journalContentSearchLocalService = journalContentSearchLocalService; } @Reference(target = ModuleServiceLifecycle.PORTAL_INITIALIZED, unbind = "-") protected void setModuleServiceLifecycle( ModuleServiceLifecycle moduleServiceLifecycle) { } private ConfigurationProvider _configurationProvider; private JournalContentSearchLocalService _journalContentSearchLocalService; }