001
014
015 package com.liferay.portal.events;
016
017 import com.liferay.portal.kernel.events.ActionException;
018 import com.liferay.portal.kernel.events.SimpleAction;
019 import com.liferay.portal.kernel.log.Log;
020 import com.liferay.portal.kernel.log.LogFactoryUtil;
021 import com.liferay.portal.kernel.notifications.ChannelHubManagerUtil;
022 import com.liferay.portal.kernel.notifications.DuplicateChannelHubException;
023 import com.liferay.portal.kernel.util.GetterUtil;
024
025
029 public class ChannelHubAppStartupAction extends SimpleAction {
030
031 @Override
032 public void run(String[] ids) throws ActionException {
033 try {
034 long companyId = GetterUtil.getLong(ids[0]);
035
036 if (_log.isDebugEnabled()) {
037 _log.debug("Creating channel hub " + companyId);
038 }
039
040 ChannelHubManagerUtil.createChannelHub(companyId);
041 }
042 catch (DuplicateChannelHubException dche) {
043 if (_log.isWarnEnabled()) {
044 _log.warn(dche.getMessage());
045 }
046 }
047 catch (Exception e) {
048 throw new ActionException(e);
049 }
050 }
051
052 private static Log _log = LogFactoryUtil.getLog(
053 ChannelHubAppStartupAction.class);
054
055 }